#include "mystdio.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>

#define FILENAME  "log.txt"

int main()
{
    my_FILE* fp = my_fopen(FILENAME, "w");
    if (fp == NULL) return 1;

    const char* str = "Hello Bit";
    int cnt = 10;
    char buff[128];
    while (cnt--)
    {
        sprintf(buff, "%s - %d", str, cnt);
        my_fwrite(fp, buff, strlen(buff));
        sleep(1);
        my_fflush(fp);
    }
    my_fclose(fp);

    return 0;
}
